<?php
/**
 * Params list of plugin setting form.
 */
$params = get_input('params');



if(strpos($params["path_weka"],"weka.jar") && strpos($params["path_wn"],"wn"))
{
		
		
	
	$plugin = elgg_get_plugin_from_id(get_input('plugin_id'));
	$plugin->setSetting('path_wn', $params["path_wn"] );
	$plugin->setSetting('path_weka', $params["path_weka"] );
		
		$bool_user = 'false';
		$bool_blog = 'false';
		$bool_file = 'false';
		$bool_bookmarks = 'false'; 
		$bool_page = 'false'; 
		$bool_group = 'false'; 
	
		for($i=0;$i<count($params["checkbox_recommender_entity"]);$i++)
		{
			$entity = $params["checkbox_recommender_entity"][$i]; 
			
			switch($entity)
			{
				case 'user':
					$bool_user = 'true';
				break;
				
				case 'group':
					$bool_group = 'true'; 
				break;
				
				case 'blog':
					$bool_blog = 'true';
				break;
				
				case 'file':
					$bool_file = 'true';
				break;
				
				case 'bookmarks':
					$bool_bookmarks = 'true'; 
				break;
				
				case 'page':
					$bool_page = 'true';
				break;
			}
			
			
			
			
		}	

		$plugin->setSetting('recommender_user',$bool_user);
		$plugin->setSetting('recommender_group',$bool_group);
		$plugin->setSetting('recommender_blog',$bool_blog);
		$plugin->setSetting('recommender_file',$bool_file);
		$plugin->setSetting('recommender_bookmars',$bool_bookmarks);
		$plugin->setSetting('recommender_page',$bool_page);
			
		
	system_message(elgg_echo('plugins:settings:save:ok', array($plugin_name)));
}
else
{
	register_error(elgg_echo('plugins:settings:save:fail', array($plugin_name)));
}

?>